from django.contrib import admin
from .models import Equipment


@admin.register(Equipment)
class EquipmentAdmin(admin.ModelAdmin):
    """
    设备资源管理界面
    """
    list_display = ['id', 'organization', 'device_name', 'device_quantity', 'device_capacity', 'created_at', 'updated_at']
    list_filter = ['organization', 'created_at']
    search_fields = ['organization', 'device_name']
    ordering = ['-created_at']
    readonly_fields = ['created_at', 'updated_at']
    
    fieldsets = (
        ('基本信息', {
            'fields': ('organization', 'device_name')
        }),
        ('设备参数', {
            'fields': ('device_quantity', 'device_capacity')
        }),
        ('时间信息', {
            'fields': ('created_at', 'updated_at'),
            'classes': ('collapse',)
        }),
    )
